public class text_5 {
    public static void main(String[] args) {
        for (int i = 1; i <=999; i++) {
            int count = 0;
            int stmp =i;
            while(stmp!=0){//算出这是几位数
                stmp /= 10;
                count++;
            }
            double num = 0;
            stmp = i;
            while(stmp!=0){
                num = num + Math.pow(stmp%10,count);
                stmp /=10;
            }
            if(num == i){
                System.out.println(i+"是水仙花数 ");
            }
        }
    }
}
